package cn.bdqn.dao;

import java.util.Date;
import java.util.List;

import cn.bdqn.dao.impl.NewsCommentDaoImpl;
import cn.bdqn.pojo.News;
import cn.bdqn.pojo.NewsComment;

public class TestNewsCommentDao {
	
	public static void main(String[] args) {
		//通过实例化实现类来初始化接口
		NewsCommentDao newsCommentDao = new NewsCommentDaoImpl();
		
		NewsComment newsComment = new NewsComment();
//		newsComment.setId(5);
		newsComment.setNewsId(1);
//		newsComment.setAuthor("游客1");
//		newsComment.setContent("匿名评论update！");
//		newsComment.setIp("19.168.1.1");
//		newsCommentDao.add(newsComment);
		
//		newsCommentDao.update(newsComment);
		
//		newsCommentDao.deleteById(newsComment);
		
		//newsCommentDao.deleteByNewsId(newsComment);
		
		News news = new News();
		
		news.setId(1);
		List<NewsComment> newsCommentList = newsCommentDao.getNewsCommentListByNewsId(news);
		for(NewsComment _newsComment:newsCommentList){
			System.out.println("id: " + _newsComment.getId() + "\t content: " + _newsComment.getContent() + "\t author: " + _newsComment.getAuthor());
		}
		
		
	}
}
